//
//  MainViewController.m
//  DuckAndDoc
//
//  Created by 蓝水软件 on 2017/5/5.
//  Copyright © 2017年 苏州蓝水有限公司. All rights reserved.
//

#import "MainViewController.h"
#import "LeftDrawerViewController.h"

@interface MainViewController ()<LeftDrawerPushControllerDelegate>

@end

@implementation MainViewController
- (void)viewWillAppear:(BOOL)animated{
    [self.mm_drawerController setOpenDrawerGestureModeMask:MMOpenDrawerGestureModeAll];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setGesture];
    [self setUI];
}

- (void)setUI{
    [self UIConfig];
    self.view.backgroundColor = [UIColor flatBlueColor];
}

- (void)UIConfig{
    [self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
    self.navigationController.navigationBar.shadowImage = [UIImage new];
    self.navigationController.navigationBar.translucent = YES;
    self.view.backgroundColor = QXWhiteColor;
}

#pragma mark -- 设置手势
- (void)setGesture{
    UITapGestureRecognizer * doubleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(doubleTap:)];
    [doubleTap setNumberOfTapsRequired:2];
    [self.view addGestureRecognizer:doubleTap];
}

#pragma mark -- 响应事件
-(void)doubleTap:(UITapGestureRecognizer*)gesture{
    [self.mm_drawerController bouncePreviewForDrawerSide:MMDrawerSideLeft completion:nil];
}

#pragma mark -- 跳转界面系协议
- (void)leftDrawer:(UIViewController *)leftDrawer pushViewController:(UIViewController *)viewController{
    [self.navigationController pushViewController:viewController animated:NO];
    [self.mm_drawerController closeDrawerAnimated:YES completion:nil];
    [self.mm_drawerController setOpenDrawerGestureModeMask:MMOpenDrawerGestureModeNone];
}

#pragma mark -- lazy load

@end
